package cn.edu.xjtu.nbrash.xbarsuite.floatbutton;

import cn.edu.xjtu.nbrash.xbarsuite.RashIntents;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

public class LaunchReceiver extends BroadcastReceiver {
	public LaunchReceiver() {
	}

	@Override
	public void onReceive(Context context, Intent intent) {
		if (context.getSharedPreferences(
				RashIntents.FloatButton.FLOAT_BUTTON_PREFERENCES,
				Context.MODE_PRIVATE).getBoolean(
				RashIntents.FloatButton.FLOAT_BUTTON_PERMISSION,
				RashIntents.FloatButton.FLOAT_BUTTON_PERMISSION_DEFAULT)) {
			if (!FloatButtonService.isFloatButtonExist()) {
				Intent service = new Intent(context.getApplicationContext(),
						StickyService.class);
				context.getApplicationContext().startService(service);
			}
		}
	}
}
